home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mscheap2 / reloc.c < prev    next >
C/C++ Source or Header  |  1990-03-07  |  744b  |  41 lines

  1.         #include <stdio.h>
  2.  
  3.         #include <heap.h>
  4.  
  5.         //
  6.         //  Example of _relocate from heap.man
  7.         //
  8.  
  9.         int main()
  10.         {
  11.         void far *p1 = _fmalloc( 1000 );
  12.  
  13.         void far *p2 = _fmalloc( 2000 );
  14.  
  15.         void far *p3 = _fmalloc( 3000 );
  16.  
  17.         void far *p4 = _fmalloc( 4000 );
  18.  
  19.         void far *new;
  20.  
  21.         _ffree( p1 );
  22.  
  23.         _ffree( p3 );
  24.  
  25.         printf("Before relocation\n\n");
  26.  
  27.         _fheapdump( stdout, 1 );
  28.  
  29.         new = _frelocate( p2 );   if (new != NULL)   p2 = new;
  30.  
  31.         new = _frelocate( p4 );   if (new != NULL)   p4 = new;
  32.  
  33.         printf("After relocation\n\n");
  34.  
  35.         _fheapdump( stdout, 1 );
  36.  
  37.         return( 0 );
  38.         }
  39.  
  40.  
  41.